package com.iran.flyWeight;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

public class FlyWeightFactory {
    private ConcurrentHashMap flyWeights = new ConcurrentHashMap();

    public FlyWeightFactory() {
        flyWeights.put("A",new ConcreteFlyWeight());
        flyWeights.put("B",new ConcreteFlyWeight());
        flyWeights.put("C",new ConcreteFlyWeight());
    }

    public FlyWeight getFlyWeight(String key){
        return (FlyWeight) flyWeights.get(key);
    }
}
